/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package foalvleditor.core;

import java.io.File;
import javax.swing.filechooser.FileFilter;

/**
 *
 * @author Mikael
 */
public class FileDialogFilter extends FileFilter {

    private transient String filename;
    private transient String description;

    public FileDialogFilter(String name){
        super();
        this.filename=name;
    }

    public FileDialogFilter(String name, String desc){
        this(name);
        this.description=desc;
    }

    @Override
    public boolean accept(File file) {
        if (file.isDirectory() || file.getName().endsWith(filename))
            return true;
        return false;
    }

    @Override
    public String getDescription() {
        return description;
    }

}
